FROM golang:1.20 AS build

ENV GO111MODULE=on
ENV GOPROXY=https://goproxy.cn,direct

WORKDIR /go/src/app
ADD . /go/src/app
RUN GOOS=linux CGO_ENABLED=0 GOARCH=amd64 go build -ldflags="-s -w" -installsuffix cgo -o events-collector main.go

FROM busybox as prod

WORKDIR /
COPY --from=build /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
COPY --from=build /go/src/app/events-collector . 

CMD ["./events-collector", "start"]
